package dem1;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-29
 * Time: 12:42
 */

//class Person1{//父类
//    public String name;
//    public int age;
//}
//class Student1 extends Person1{//子类
//    public int grades;
//    public Student(int grades){
//        this.super();//this和super同时出现,报错
//        this.grades = grades;
//    }
//}
class Person{
    public String name;
    public int age;

    static {
        System.out.println("父类静态代码块");
    }

    {
        System.out.println("父类实例代码块");
    }

    public Person(){
        System.out.println("父类构造方法");
    }

}
class Student extends Person{
    static {
        System.out.println("子类静态代码块");
    }

    {
        System.out.println("子类实例代码块");
    }

    public Student(){
        System.out.println("子类构造方法");
    }
}

public class Test {
    public static void main(String[] args) {
        //Student student = new Student(13);
        new Student();
    }
}
